

function addBillBoard(viewer) {
    if (viewer == undefined) {
        viewer = new Cesium.Viewer("cesiumContainer")
    }
    var position1 = Cesium.Cartesian3.fromDegrees(120.42908, 36.31467, 120);
    var billBoard = viewer.entities.add({
        id: 'billboard01',
        position: position1,
        billboard: {
            image: '/img/doctortip.png',
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
            color: undefined,
            width: 300,
            height: 200,
        }
    })
    //右键取消镜头锁定
    var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
    handler.setInputAction((movement) => {
        var pick = viewer.scene.pick(movement.position);
        if (pick) {
            viewer.trackedEntity = undefined
        }
    }, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
}
function addLabel(viewer){
    var text1 =viewer.entities.add({
        id:'point1',
        position:Cesium.Cartesian3.fromDegrees(120.42680,36.31562,0),
        point:{
            pixelSize: 2,
            // color:Cesium.Color.BLACK,
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
        },
        label:{
            text:'春阳路',
            fillColor:Cesium.Color.BLUE,
            pixelOffset:new Cesium.Cartesian2(0,-20),
            scale:0.6,
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
        }
    })

    var text2 =viewer.entities.add({
        id:'point2',
        position:Cesium.Cartesian3.fromDegrees(120.42828,36.31884,0),
        point:{
            pixelSize: 2,
            // color:Cesium.Color.BLACK,
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
        },
        label:{
            text:'荟城路',
            fillColor:Cesium.Color.RED,
            pixelOffset:new Cesium.Cartesian2(0,-20),
            scale:0.6,
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
        }
    });
    var text3 =viewer.entities.add({
        id:'point3',
        position:Cesium.Cartesian3.fromDegrees(120.43252,36.31165,0),
        point:{
            pixelSize: 2,
            // color:Cesium.Color.BLACK,
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
        },
        label:{
            text:'瑞阳路',
            fillColor:Cesium.Color.GREEN,
            pixelOffset:new Cesium.Cartesian2(0,-20),
            scale:0.6,
            scaleByDistance: new Cesium.NearFarScalar(500, 2.0, 5000, 0.5),
        }
    })
}

export {
    addBillBoard,
    addLabel
};